<!doctype html>
<html lang="en">

{include file='public/header'}

<body class="login-bg">
    <div class="main-body">
        <div class="login-main">
            <div class="login-top">
                <span>比翼鸟cps管理</span>
                <span class="bg1"></span>
                <span class="bg2"></span>
            </div>
            <form class="layui-form login-bottom">
                <div class="center">
                    <div class="item">
                        <span class="icon icon-2"></span>
                        <input type="text" name="username" lay-verify="required"  placeholder="请输入登录账号" maxlength="24"/>
                    </div>
    
                    <div class="item">
                        <span class="icon icon-3"></span>
                        <input type="password" name="password" lay-verify="required"  placeholder="请输入密码" maxlength="20">
                    </div>
                </div>
                
                <div class="layui-form-item" style="text-align:center; width:100%;height:100%;margin:0px;">
                    <button class="login-btn" lay-submit="" lay-filter="login">立即登录</button>
                </div>
            </form>
        </div>
        <a style="color: #dedede;margin-top: 300px;" href='https://beian.miit.gov.cn'>湘ICP备2022017578号-2</a>

    </div>

    <script>
        layui.use('form', function(){
            var form = layui.form;
            form.on('submit(login)', function(data){
                Ajax('/cps/login/login', data.field).then(data => {
                    if (data.code===200) {
                        data.data['token_time'] = new Date().getTime()
                        localStorage.setItem('cpsToken',data.data.token)
                        localStorage.setItem('cpsMessage',JSON.stringify(data.data))
                        layer.msg('登录成功!',{icon:1,time:1500},function () {
                            jumpUrl('/cps/index/index?token='+data.data.token,true)
                        });
                        return false;
                    }
                });
                return false;
            });
        });
    </script>

    
</body>
</html>